package cn.tedu.rabbitmqspring.m2;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class Consumer {

    //启动一个消费者，从队列接收消息，并传递给这个方法进行处理
    //消费者自动启动，不需要手动调用
    @RabbitListener(queues = "task_queue111")
    public void receive1(String msg){
        System.out.println("消费者1收到:"+msg);
    }

    @RabbitListener(queues = "task_queue111")
    public void receive2(String msg){
        System.out.println("消费者2收到:"+msg);
    }

}
